﻿<Page x:Class="LprMiddleWare.Views.MainPage"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      xmlns:dxlc="http://schemas.devexpress.com/winfx/2008/xaml/layoutcontrol"
      xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
      DataContext="{Binding MainViewModel, Source={StaticResource Locator}}"
      mc:Ignorable="d"
    Title="MainPage"
      d:DesignHeight="355"
      d:DesignWidth="411">
    <Page.Resources>
        <DataTemplate x:Key="DataTemplateLogEntry">

            <TextBlock TextWrapping="Wrap"
                       d:LayoutOverrides="Width, Height">
                    <Run Text="[" />
                    <Run Text="{Binding LogTime}" />
                    <Run Text="]:" />
                    <Run Text="{Binding Message}" />
            </TextBlock>

        </DataTemplate>
    </Page.Resources>

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="145*" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <dxe:ImageEdit  x:Name="imageEdit1"
                        MinHeight="200"
                        Source="{Binding CurrentImage}"
                        ShowMenu="False" />
        <Border BorderBrush="Black"
                Grid.Row="1"
                >
            <Grid x:Name="LicensePlate"
                  Background="#FFFFFBFB">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"
                                      MinWidth="60.003" />
                    <ColumnDefinition Width="Auto"
                                      MinWidth="82.494" />
                    <ColumnDefinition />
                    <ColumnDefinition Width="Auto"
                                      MinWidth="54.636" />
                    <ColumnDefinition Width="Auto"
                                      MinWidth="78.695" />
                </Grid.ColumnDefinitions>
                <TextBlock Text="{Binding CurrentPlate.LicenseNumber}"
                           x:Name="LicensePlateNumber"
                           FontSize="32"
                           d:LayoutOverrides="Width, Height"
                           Grid.Column="2"
                           Grid.RowSpan="2"
                           HorizontalAlignment="Center"
                           VerticalAlignment="Top" />
                <Label Content="设备:"
                       VerticalAlignment="Center"
                       HorizontalAlignment="Center" />
                <Label Content="车道:"
                       Grid.Row="1"
                       VerticalAlignment="Center"
                       HorizontalAlignment="Center" />
                <Label Content="抓拍时间:"
                       Grid.Column="3"
                       HorizontalAlignment="Center"
                       VerticalAlignment="Center" />
                <TextBlock x:Name="DeviceId"
                           Text="{Binding CurrentPlate.DeviceId}"
                           Grid.Column="1"
                           HorizontalAlignment="Left"
                           VerticalAlignment="Center" />
                <TextBlock x:Name="LaneNo"
                           Text="{Binding CurrentPlate.LanNo}"
                           Grid.Column="1"
                           Grid.Row="1"
                           VerticalAlignment="Center"
                           HorizontalAlignment="Left" />
                <TextBlock x:Name="CaptureTime"
                           Text="{Binding CurrentPlate.CaptureTime, StringFormat=MM-dd HH:mm:ss}"
                           Grid.Column="4"
                           VerticalAlignment="Center"
                           HorizontalAlignment="Left" />
            </Grid>
        </Border>
        <dxlc:GroupBox Header="系统日志"
                       Padding="0"
                       Grid.Row="2"
                       >
            <dxe:ListBoxEdit ItemTemplate="{DynamicResource DataTemplateLogEntry}"
                             MinHeight="100"
                             ItemsSource="{Binding Logs}" />
        </dxlc:GroupBox>

    </Grid>
</Page>
